package com.itheima.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.itheima.common.R;
import com.itheima.dao.TbClueDao;
import com.itheima.dto.ClueQueryDto;
import com.itheima.pojo.TbClue;
import com.itheima.service.TbClueService;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 线索(TbClue)表服务实现类
 *
 * @author makejava
 * @since 2022-01-16 15:48:53
 */
@Service("tbClueService")
public class TbClueServiceImpl implements TbClueService {
    @Resource
    private TbClueDao tbClueDao;


    @Override
    public R page(ClueQueryDto clueQueryDto) {

        IPage<TbClue> pageInfo=new Page<>(clueQueryDto.getPage(),clueQueryDto.getPageSize());
        LambdaQueryWrapper<TbClue> lqw=new LambdaQueryWrapper<>();
        lqw.eq(TbClue::getId,clueQueryDto.getId());
        lqw.eq(TbClue::getPhone,clueQueryDto.getPhone());
        lqw.eq(TbClue::getCreateBy,clueQueryDto.getCreateBy());
        lqw.eq(TbClue::getStatus,clueQueryDto.getStatus());
        lqw.eq(TbClue::getChannel,clueQueryDto.getChannel());
        tbClueDao.selectPage(pageInfo,lqw);
        return new R(1,"返回线索分页",pageInfo);

    }
}
